From 4a8c3511f17ffca649784faa659d7745d10c21c6 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Wed, 1 Mar 2006 23:39:43 +0100 Subject: [PATCH] Add SVM 32bit msr support (combined both 32bit with 64bit functions) and enable vlapic for 64bit. Signed-off-by: Tom Woller --- xen/arch/x86/hvm/svm/svm.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index 345aca07d6..0b2a6765f1 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -247,6 +247,7 @@ void svm_load_msrs(void) void svm_restore_msrs(struct vcpu *v) { } +#endif #define IS_CANO_ADDRESS(add) 1 @@ -297,8 +298,13 @@ static inline int long_mode_do_msr_read(struct cpu_user_regs *regs) return 0; } +#ifdef __x86_64__ HVM_DBG_LOG(DBG_LEVEL_2, "mode_do_msr_read: msr_content: %lx\n", msr_content); +#else + HVM_DBG_LOG(DBG_LEVEL_2, "mode_do_msr_read: msr_content: %llx\n", + msr_content); +#endif regs->eax = msr_content & 0xffffffff; regs->edx = msr_content >> 32; @@ -311,12 +317,18 @@ static inline int long_mode_do_msr_write(struct cpu_user_regs *regs) struct vcpu *vc = current; struct vmcb_struct *vmcb = vc->arch.hvm_svm.vmcb; +#ifdef __x86_64__ HVM_DBG_LOG(DBG_LEVEL_1, "mode_do_msr_write msr %lx msr_content %lx\n", regs->ecx, msr_content); +#else + HVM_DBG_LOG(DBG_LEVEL_1, "mode_do_msr_write msr %x msr_content %llx\n", + regs->ecx, msr_content); +#endif switch (regs->ecx) { case MSR_EFER: +#ifdef __x86_64__ if ((msr_content & EFER_LME) ^ test_bit(SVM_CPU_STATE_LME_ENABLED, &vc->arch.hvm_svm.cpu_state)) { @@ -337,6 +349,7 @@ static inline int long_mode_do_msr_write(struct cpu_user_regs *regs) if ((msr_content ^ vmcb->efer) & EFER_LME) msr_content &= ~EFER_LME; /* No update for LME/LMA since it have no effect */ +#endif vmcb->efer = msr_content | EFER_SVME; break; @@ -383,18 +396,6 @@ static inline int long_mode_do_msr_write(struct cpu_user_regs *regs) return 1; } -#else -static inline int long_mode_do_msr_read(struct cpu_user_regs *regs) -{ - return 0; -} - -static inline int long_mode_do_msr_write(struct cpu_user_regs *regs) -{ - return 0; -} -#endif - void svm_store_cpu_guest_ctrl_regs(struct vcpu *v, unsigned long crs[8]) { struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb; @@ -937,10 +938,8 @@ static void svm_vmexit_do_cpuid(struct vmcb_struct *vmcb, unsigned long input, if (input == 1) { -#ifndef __x86_64__ if ( hvm_apic_support(v->domain) && !vlapic_global_enabled((VLAPIC(v))) ) -#endif clear_bit(X86_FEATURE_APIC, &edx); #if CONFIG_PAGING_LEVELS < 3 -- 2.30.2